<!DOCTYPE html>
<html>

<head>
    <#include "/yq/admin/components/meta.html" />
    <title>蓁奕科技 ${metaTitleSuffix!}</title>
    <#include "/yq/admin/components/stylesheets.html" />
</head>

<body>
    <div id='app'>
        <el-container>
            <#assign menuIndex="5-1" />
            <#include "/yq/admin/components/menu.html" />
            <el-container>
                <#include "/yq/admin/components/header.html" />
                <el-main>
                    <template>
                        <el-row class="header theme-color1">模块内容 - ${(model.title)!}</el-row>
                        <el-button @click='onAdd'>新增</el-button>
                        <el-table :data="items" style="width: 100%">
                            <!-- <el-table-column prop="id" label="id">
                            </el-table-column> -->
                            <el-table-column prop="cover" label="封面" width="70">
                                <template slot-scope="scope">
                                    <img :src="scope.row.cover" style="max-width: 50px;max-height: 50px;">
                                </template>
                            </el-table-column>
                            <el-table-column prop="title" label="标题">
                            </el-table-column>
                            <el-table-column prop="subtitle" label="副标题">
                            </el-table-column>
                            <el-table-column prop="productTitle" label="商品">
                            </el-table-column>
                            <el-table-column prop="subModelTitle" label="模块">
                            </el-table-column>
                            <el-table-column prop="categoryTitle" label="类目">
                            </el-table-column>
                            <el-table-column prop="isShow" label="是否显示" width="80">
                                <template slot-scope="scope">
                                    <span v-if="scope.row.isShow == 1">显示</span>
                                    <span v-if="scope.row.isShow == 0">隐藏</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="sort" label="排序" width="80">
                            </el-table-column>
                            <el-table-column prop="addTime" label="添加时间" width="170">
                            </el-table-column>
                            <el-table-column  label="操作" width="150">
                                <template slot-scope="scope">
                                    <a :href ="'/yq/admin/model/modelInfoItem?modelInfoId=' + scope.row.id">详情</a>
                                    <el-button size='small' @click="onDelte(scope.row)">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <#include '/components/page.html' />
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/yq/admin/components/footer.html" />
    </div>
    <#include "/yq/admin/components/scripts.html" />
    <script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data() {
            return {
                items: toJson(`${data![]}`)
            }
        },
        mounted: function() {},
        methods: {
            onAdd(){
                location.href = '/yq/admin/model/modelInfoItem?modelId=${(model.id)!}';
            },
            onDelte(info) {
                this.$confirm('确定删除?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    var param = {
                        shopId: info.id
                    }
                    axiosRequest(param, '/yq/admin/model/deleteModelInfo', '')
                }).catch(() => {});
            },
            onDateChange(val) {
                var keys = [
                    { key: 'startDate', value: val[0] },
                    { key: 'endDate', value: val[1] }
                ]
                goPage(1, keys)
            },
        },
        filters: {
            fmt(date) {
                return date
            }
        }
    })
    </script>
    <style scoped>
        .header {
            margin-bottom: 10px;
        }
    </style>
</body>

</html>